<?php
class CmsCommentListControl extends CmsBaseControl
{
    protected $postId;

    public function CmsCommentListControl($post_id)
    {
        $this->postId = $post_id;
        parent::__construct();
    }

    public function Render()
    {
        $comments = CmsCommentModel::GetInstance()->GetByPostId($this->postId);
        $this->Repeat('comment', $comments, array($this, 'Format'));
        return parent::Render();
    }

    public function Format($item)
    {
        $item['datecreated'] = DatetimeBase::GetRelativeTime($item['datecreated']);
        return $item;
    }
}
?>
